FROM nginx:1.17.4-alpine

ENV TZ=Asia/Shanghai
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

RUN mkdir -p /usr/share/nginx/html/
RUN mkdir -p /usr/share/nginx/html/subapp/sub-react/
RUN mkdir -p /usr/share/nginx/html/subapp/sub-vue/
RUN mkdir -p /etc/nginx/conf.d
RUN mkdir -p /var/log/nginx

ARG env=dev
# copy files to nginx root
COPY ./main/dist /usr/share/nginx/html/
COPY ./sub-react/build /usr/share/nginx/html/subapp/sub-react/
COPY ./sub-vue/dist /usr/share/nginx/html/subapp/sub-vue/
COPY ./nginx.conf /etc/nginx/nginx.conf
COPY ./default-${env}.conf /etc/nginx/conf.d/default.conf

EXPOSE 80

CMD ["nginx", "-g", "daemon off;"]